<%--
  Created by IntelliJ IDEA.
  User: bryant
  Date: 10/31/12
  Time: 2:34 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<%@ taglib prefix="code" uri="/WEB-INF/tld/code.tld" %>
<script type="text/javascript" src="<%=request.getContextPath() %>/scripts/jquery-1.8.2.js"></script>
<title>商品查询</title>
<script type="text/javascript">
    $("#municipio").live('change', function () {
                $("#town").empty();
                $("#town").append("<option value=''>请选择</option>");
                $("#village").empty();
                $("#village").append("<option value=''>请选择</option>");
                var codeId = $("#municipio").val();
                $.ajax({
                    type:"POST",
                    url:"/ocgs-admin/getChildCodeDesc",
                    data:{ codeTypeId:"5", codeId:codeId },
                    dataType:"text",
                    success:function (jsonResult) {
                        var obj = $.parseJSON(jsonResult);
                        $.each(obj.jsonResult, function (i,code) {
                            $("#town").append("<option value=" + code.codeId + ">" + code.codeDesc + "</option>")
                        });
                    }
                });
            }
    );

    $("#town").live('change', function () {
                $("#village").empty();
                $("#village").append("<option value=''>请选择</option>");
                var codeId = $("#town").val();
                $.ajax({
                    type:"POST",
                    url:"/ocgs-admin/getChildCodeDesc",
                    data:{ codeTypeId:"6", codeId:codeId },
                    dataType:"text",
                    success:function (jsonResult) {
                        var obj = $.parseJSON(jsonResult);
                        $.each(obj.jsonResult, function (i,code) {
                            $("#village").append("<option value=" + code.codeId + ">" + code.codeDesc + "</option>")
                        });
                    }
                });
            }
    );
</script>
<form action="findChildCodeDesc" method="post">
    <div id="main-content">
        <div>
            <table>
                <tr>
                    <td width="10%"><label>地址</label></td>
                    <td colspan="3">
                        <code:codeSelect id='municipio' name="codeId" cdTypeId="5" headerKey="" headerValue="请选择"/>
                        &nbsp;
                        <select id='town'>
                            <option value="">请选择</option>
                        </select>
                        <select id='village'>
                            <option value="">请选择</option>
                        </select>

                    </td>
                </tr>
            </table>
        </div>

    </div>
</form>